package fixtures;

import fit.ActionFixture;
import Controllers.ClientController;
import Controllers.InitiateSaleController;
import Controllers.LoginController;
import Controllers.ServerController;
import Entities.ClientEntity;
import Entities.InitiateSaleEntity;
import Entities.LoginEntity;
import Entities.ServerEntity;
import GUI.ClientGUI;
import GUI.InitiateSaleGUI;
import GUI.LoginGUI;
import GUI.ServerGUI;

public class InitiateSale extends ActionFixture{
	

		private ServerController serverController;
		private ClientController clientController;
		private InitiateSaleController initiateSaleController;
		private InitiateSaleGUI initiateSaleGUI;
		private InitiateSaleEntity initiateSaleEntity;
		private LoginController loginController;
		public InitiateSale()
		{
			
			ServerGUI serverGui=new ServerGUI();
			ServerEntity serverEnt= new ServerEntity();
			serverController=new ServerController(serverGui, serverEnt);
			ClientGUI clientGUI=new ClientGUI();
			ClientEntity clientEntity=new ClientEntity();
			clientController=new ClientController(clientGUI, clientEntity);
			
			serverGui.getBtnConnect().doClick();
			clientGUI.getBtnConnect().doClick();
	//		loginController=new LoginController(new LoginGUI(),new LoginEntity());
			initiateSaleGUI=new InitiateSaleGUI();
			initiateSaleEntity = new InitiateSaleEntity();
			initiateSaleController=new InitiateSaleController(initiateSaleEntity, initiateSaleGUI);

			
			
		}
		
		public void clickButton()
		{
			initiateSaleGUI.getOkButton().doClick();
		}
		public void setMp(int index)
		{
			initiateSaleGUI.getMpList().setSelectedIndex(index);
		}
		public void setDate(String date)
		{
			initiateSaleGUI.getDateTf().setText(date);
		}
		public void setPeriod(String period)
		{
			initiateSaleGUI.getPeriodTf().setText(period);
		}
		public boolean validateInput()
		{
			if(initiateSaleController.validateInput())
				return true;
			return false;
		}
		
	

}
